class shape{
    public void draw(){
        System.out.println("画图形！");
    }
}

class Rect extends shape{
    public void draw(){
        System.out.println("◆");
    }
}

class Cycle extends shape{
    public void draw(){
        System.out.println("●");
    }
}
class Flower extends shape{
    public void draw(){
        System.out.println("♣");
    }
}
public class Test2 {
    public static void main(String[] args) {
        Rect rect =new Rect();
        Cycle cycle =new Cycle();
        Flower flower =new Flower();
        shape[] shapes={rect,cycle,flower};
        for (shape shape:shapes) {
            shape.draw();
        }
    }


    public static void main1(String[] args) {
        Rect rect =new Rect();
        Cycle cycle =new Cycle();
        Flower flower =new Flower();
        String[] shapes={"rect","cycle","flower"};
        for (String shape:shapes) {
            if(shape.equals("rect")){
                rect.draw();
            }else if(shape.equals("cycle")){
                cycle.draw();
            }else if(shape.equals("flower")){
                flower.draw();
            }
        }
    }
}
